<?php 
$page_group_id=$_GET['group_id'];
$id=$_GET['id'];
$row=Page::fetch_page_by_id($id);
if($page_group_id==3)
	$page_title=$row['page_title']."<span>Ngày đăng: ".date('d/m/Y').".";
else if($page_group_id==4)
	$page_title="Mã số: ".$row['page_title']."<span>Ngày đăng: ".date('d/m/Y').". Trạng thái: ".($row['page_sent']==1?'đã':'chưa')." giao.</span>";
$page_content=$row['page_content'];
$query="SELECT * FROM tbl_page WHERE page_id>$id AND page_group_id=$page_group_id AND page_status=1 ORDER BY page_id DESC  LIMIT 4 ";
$table_1=Db::mysql_query($query,FETCH_MODE_TABLE);
$limit=4+4-count($table_1);
$query="SELECT * FROM tbl_page WHERE page_id<$id AND page_group_id=$page_group_id AND page_status=1 ORDER BY page_id DESC LIMIT $limit ";
$table_2=Db::mysql_query($query,FETCH_MODE_TABLE);
$table=array_merge($table_1,$table_2);
?>

<div class="post hentry uncustomized-post-template">
<div class="post_bottom">
<h2 class="post-title entry-title">
	<a><?php echo $page_title;?></a>
</h2>
<div class="post_date"><?php echo $page_group_id==3?LTIN_TUC:LLOP_DAY_HIEN_CO;?></div>
<div class="entry i-update" link='page=_update-<?php echo $page_group_id==3?'news':'class'?>&id=<?php echo $id?>&page_group_id=<?php echo $page_group_id;?>' >
	
	<?php echo $page_content;?>
	
</div>
<div id='respond'>
	<h3>Các <?php echo $page_group_id==3?'tin':'lớp dạy'?> khác</h3>
	<ul>
		<?php foreach ($table as $row){?>
		<li><a href='index.php?page=<?php echo $row['page_name']?>&id=<?php echo $row['page_id']?>&group_id=<?php echo $page_group_id?>'><?php echo $row['page_title']?></a></li>
		<?php }?>
	</ul>
	</div>
<div class="read_comments"><a href="index.php?page=<?php echo $page_group_id==3?'tin-tuc':'lop-day-hien-co'?>">Trở về</a><a href="#body">Về đầu trang</a></div>
</div>
</div>